<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>店长推荐</title>


    <link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.tools.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/datePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $().ready(function () {

            var $inputForm = $("#inputForm");
            var $isExchange = $("#isExchange");
            var $point = $("#point");

        [@flash_message /]

            // 是否允许积分兑换
            $isExchange.click(function () {
                if ($(this).prop("checked")) {
                    $point.prop("disabled", false);
                } else {
                    $point.val("").prop("disabled", true);
                }
            });

            $.validator.addMethod("compare",
                    function (value, element, param) {
                        var parameterValue = $(param).val();
                        if ($.trim(parameterValue) == "" || $.trim(value) == "") {
                            return true;
                        }
                        try {
                            return parseFloat(parameterValue) <= parseFloat(value);
                        } catch (e) {
                            return false;
                        }
                    },
                    "${message("admin.coupon.compare")}"
            );

            // 表单验证
            $inputForm.validate({
                rules: {
                    sn: {
                        pattern: /^[0-9a-zA-Z_-]+$/,
                        remote: {
                            url: "/asl-admin/recommendCommodity/isExisted.htm",
                            cache: false
                        }
                    },
                    startDate: "required",
                    endDate:"required"
                },
                messages: {
                    sn: {
                        pattern: "输入格式不正确",
                        remote: "商品不存在"
                    }

                }
            });

        });
    </script>
</head>
<body>
<div class="path">
    <a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; ${message("admin.coupon.add")}
</div>
<form id="inputForm" action="save.htm" method="post">
    <ul id="tab" class="tab">
        <li>
            <input type="button" value="${message("admin.coupon.base")}"/>
        </li>
    </ul>
    <div class="tabContent">
        <table class="input">
            <tr>
                <th><span class="requiredField">*</span>商品编号:</th>
                <td>
                    <input type="text" placeholder="输入产品编号" name="sn" class="text" maxlength="200"/>
                </td>
            </tr>
            <tr>
                <th> ${message("Coupon.beginDate")}:</th>
                <td>
                    <input type="text" id="startDate" name="startDate" class="text Wdate"
                           onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss', maxDate: '#F{$dp.$D(\'endDate\')}'});"/>
                </td>
            </tr>
            <tr>
                <th> ${message("Coupon.endDate")}:</th>
                <td>
                    <input type="text" id="endDate" name="endDate" class="text Wdate"
                           onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss', minDate: '#F{$dp.$D(\'beginDate\')}'});"/>
                </td>
            </tr>
            <tr>
                <th> ${message("admin.common.setting")}:</th>
                <td>
                    <label>
                        <input type="checkbox" name="enable" checked value="true"/>${message("Coupon.isEnabled")}
                    </label>
                </td>
            </tr>
        </table>
    </div>

    <table class="input">
        <tr>
            <th>
                &nbsp;
            </th>
            <td>
                <input type="submit" class="button" value="${message("admin.common.submit")}"/>
                <input type="button" class="button" value="${message("admin.common.back")}"
                       onclick="location.href='list.htm'"/>
            </td>
        </tr>
    </table>
</form>
</body>
</html>